Home | | Latest | About | Random
# 24 Linear transformation, a first look.
## Definition.
Now we saw functions can be quite wild in general, and many questions about a generic randomly chosen function $f:A\to B$ can be tough to answer: What does it do, what is its range, is it injective, is it surjective, is it invertible, etc.
In linear algebra, however, we will study a specific kinds of functions called **linear transformations**. These are in fact **much tamer** among the functions. First, linear transformations are functions whose domain and codomain are both **linear spaces**, the primary object in linear algebra. And since the main structure of a linear space is that they are closed under taking linear combination, these linear transformations preserve this structure. We define it below:
> Definition.
> Let $V,W$ be linear spaces. A function $T:V\to W$ is said to be a **linear transformation** if
> (1) $T$ preserves sum: For any $x,y \in V$, we have $T(x+y)=T(x)+T(y)$.
> (2) $T$ preserves scaling: For any $x\in V$ and scalar $c$, we have $T(cx)=cT(x)$.
Tiny remark. This assumes $V,W$ are linear spaces that uses the same set of scalars, otherwise it actually doesn't make sense. Also, the phrase linear transformation is so long to spell, so I will use the phrase **linear map** for it. And if a function is a linear map, we say the function is linear, as an adjective.
**Example.**
Consider $T:\mathbb{R}\to \mathbb{R}$, where $T(x)=3x$. Is $T$ a linear map?
$\blacktriangleright$ Let us check.
(1) Does $T$ preserve sum? Take $x,y\in \mathbb{R}$, note that $T(x+y)=3(x+y)=3x+3y$. But also note that $T(x)+T(y)=3x+3y$. Hence we see $T(x+y)=T(x)+T(y)$, so $T$ preserves sum.
(2) Does $T$ preserve scaling? Take $x\in \mathbb{R}$ and $c$ a scalar. Note that $T(cx)=3(cx)=c(3x)=cT(x)$. Hence $T$ preserves scaling.
Hence $T$ is a linear map! $\blacklozenge$
**Example.**
Consider $S:\mathbb{R}\to \mathbb{R}$ given by $S(x)=3x+1$. Is $S$ a linear map?
$\blacktriangleright$ Despite one's experience from calculus-land that the function $3x+1$ has a graph that is a line, $S$ is **not a linear map**! Indeed, note that $S(1+1)=7$, but $S(1)+S(1)=4+4=8\neq 7$. So $S(1+1)\neq S(1)+S(1)$, namely $S$ does not preserve sum. Hence $S$ is not a linear map! $\blacklozenge$
Remark. This $S$ however is something called an "affine map", it's a translation of a linear map. Also, $S$ is a linear polynomial. $S$ is just not a linear transformation in our context.
**Example.**
Consider $T:\mathbb{R}^{2}\to \mathbb{R}^{3}$ such that $T\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}x+y\\y\\x-2y\end{pmatrix}$. Show $T$ is a linear map.
$\blacktriangleright$ To show $T$ is a linear map, we show that is satisfies the two properties: Preserving sum and preserving scaling.
Take two vectors $\begin{pmatrix}x\\y\end{pmatrix},\begin{pmatrix}x'\\y'\end{pmatrix}$ from $\mathbb{R}^{2}$. Note that $$
\begin{align*}
T(\begin{pmatrix}x\\y\end{pmatrix}+\begin{pmatrix}x'\\y'\end{pmatrix}) &= T\begin{pmatrix}x+x'\\y+y'\end{pmatrix}\\
&= \begin{pmatrix}(x+x')+(y+y')\\y+y' \\(x+x')-2(y+y')\end{pmatrix} \\
&= \begin{pmatrix}x+y\\y\\x-2y\end{pmatrix} + \begin{pmatrix}x'+y'\\y'\\x'-2y'\end{pmatrix} \\
&=T\begin{pmatrix}x\\y\end{pmatrix} + T\begin{pmatrix}x'\\y'\end{pmatrix}.
\end{align*}
$$Hence we see that $T$ preserves sum.
Next, take a vector $\begin{pmatrix}x\\y\end{pmatrix} \in \mathbb{R}^{2}$ and and scalar $c$. Note that $$
\begin{align*}
T(c\begin{pmatrix}x\\y\end{pmatrix}) &= T\begin{pmatrix}cx\\cy\end{pmatrix} \\
&=\begin{pmatrix}cx+cy\\ cy \\cx-2(cy)\end{pmatrix} \\
&=c\begin{pmatrix}x+y\\y\\x-2y\end{pmatrix} \\
&=cT\begin{pmatrix}x\\y\end{pmatrix}.
\end{align*}
$$So we see that $T$ preserves scaling. Hence $T$ is a linear transformation! $\blacksquare$
There are other more curious linear maps, that you actually already know.
**Example.**
Denote ${\mathscr C}^{\infty}(\mathbb{R)}$ to be the set of all functions $\mathbb{R}\to \mathbb{R}$ that are infinitely differentiable (you can keep taking derivatives). This is the class of **smooth functions**. This ${\mathscr C}^{\infty}(\mathbb{R})$ turns out to be a linear space. Denote $D:{\mathscr C}^{\infty}(\mathbb{R)}\to{\mathscr C}^{\infty}(\mathbb{R)}$ to be the derivative function: $$
D(f) = f'
$$We remark that $D$ is in fact a linear map! Indeed, from calculus we recall $$
D(f+g)=(f+g)'=f'+g'=D(f)+D(g)
$$and $$
D(cf)=(cf)'=cf'=cD(f)
$$Hence $D$ preserves sum and scaling, namely $D$ is a linear transformation. $\blacklozenge$
**Example.**
Is the function $f:\mathbb{R}\to \mathbb{R}$ given by $f(x)=x^{2}$ linear?
$\blacktriangleright$ Nope. Note that $f(2\cdot 1)=4$, but $2f(1)=2$. So we see that $f$ does not preserve scaling. Hence $f$ is **not linear**. $\blacklozenge$
**Example.** Let us fix an $n\times k$ matrix $A$, and let us define a function $$
\begin{align*}
T:\mathbb{R}^{k} \to \mathbb{R}^{n} \\
T(\vec x)=A \vec x
\end{align*}
$$This is called the **left matrix multiplication map** by matrix $A$. We claim this function is in fact a linear map! Indeed, for any two vectors $\vec x,\vec y \in \mathbb{R}^{k}$, we have $$
T(\vec x + \vec y ) = A(\vec x + \vec y)= A\vec x + A\vec y = T(\vec x) + T(\vec y),
$$and for any vector $\vec x \in \mathbb{R}^{k}$ and and any scalar $c$, we have $$
T(c\vec x)=A(c \vec x)=cA\vec x=c T(\vec x).
$$Hence we see $T$ is indeed a linear map! $\blacklozenge$
## Zero preserving property.
In general, to show a function $T:U\to V$ between two linear spaces, one ought to demonstrate $T$ both preserves sum and preserves scaling. But sometimes we want to be able to quickly tell when a function is **not linear**. So here is a necessary but not sufficient condition of linear map:
> **Proposition.** If $T:U\to V$ is a linear map, then $T$ preserves the zero element, namely $$
T(\mathbf{0}_{U})=\mathbf{0}_{V},
$$where $\mathbf{0}_{U}$ is the zero element of $U$ and $\mathbf{0}_{V}$ is the zero element of $V$.
**CAUTION.** This is a **necessary but not sufficient condition**. Namely, just because a function $f$ preserves the zero element, it need not imply $f$ is linear! For example $f(x)=x^{2}$ is not linear, but $f(0)=0$.
However, how we can use it is that if a function $f$ does not preserve the zero element, then $f$ has **no chance** of being a linear map.
**Example.** Is the function $f:\mathbb{R}^{2}\to \mathbb{R}^{2}$ with $f\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}x+1\\y\end{pmatrix}$ linear?
$\blacktriangleright$ Note that $f\begin{pmatrix}0\\0\end{pmatrix}=\begin{pmatrix}1\\0\end{pmatrix}\neq \mathbf{0}$. This shows $f$ does not preserve the zero element, so $f$ cannot be a linear map. $\blacklozenge$
Let us prove this zero preserving property of linear maps.
$\blacktriangleright$ Proof of the zero preserving property.
Suppose $T:U\to V$ is linear. Then note the zero element $\mathbf{0}_{U}=\mathbf{0}_{U}+\mathbf{0}_{U}$. Now using that $T$ is linear, we have $$
T(\mathbf{0}_{U}) =T(\mathbf{0}_{U}+\mathbf{0}_{u})=T(\mathbf{0}_{U}) +T(\mathbf{0}_{U}).
$$If we subtract both sides by $T(\mathbf{0}_{U})$, we get $$
\mathbf{0}_{V}=T(\mathbf{0}_{U})
$$as claimed. $\blacksquare$
## Left matrix multiplication maps.
As this stage, the linear spaces that are most familiar to us are $\mathbb{R}^{n}$ spaces. So let us answer this question: For fixed positive integers $n,k$, what are all the linear maps $T:\mathbb{R}^{k}\to \mathbb{R}^{n}$ ? As it turns out, **every linear map $T:\mathbb{R}^{k}\to \mathbb{R}^{n}$ is just a left matrix multiplication map by some $n\times k$ matrix $A$!**
> **Characterization.**
> Suppose $T : \mathbb{R}^{k} \to \mathbb{R}^{n}$ is a function. Then $T$ is a linear transformation if and only if there exists some $n\times k$ matrix $A$ such that $T(\vec x) = A\vec x$ for each $\vec x \in \mathbb{R}^{n}$.
> This matrix $A$ is sometimes called **the (standard) matrix of the linear map $T$**.
This is profound in the sense that this reveals what matrices really are -- Matrices are just embodiments of linear transformations, when we multiply them on the left of some column vector.
Let us look at some examples of linear maps $T:\mathbb{R}^{k}\to \mathbb{R}^{n}$ and how to find their matrix.
**Example.**
Earlier we saw the function $T:\mathbb{R}^{2}\to \mathbb{R}^{3}$ such that $T\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}x+y\\y\\x-2y\end{pmatrix}$ is linear. We demonstrate that there is a $3\times 2$ matrix $A$ that is the standard matrix for $T$. Note that $$
T\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}x+y\\y\\x-2y\end{pmatrix}=x\begin{pmatrix}1\\0\\1\end{pmatrix}+y\begin{pmatrix}1\\1\\-2\end{pmatrix}=\begin{pmatrix}1 & 1\\0 & 1\\1 & -2\end{pmatrix}\begin{pmatrix}x\\y\end{pmatrix}
$$by using what we know about matrix-vector products. So we see the standard matrix of this linear map is $$
A=\begin{pmatrix}1 & 1\\0 & 1\\1 & -2\end{pmatrix}
$$where $T(\vec x) = A\vec x$. $\blacklozenge$
**Example.**
Suppose $T:\mathbb{R}^{2}\to \mathbb{R}^{3}$ is a linear map such that $$
T \begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}3\\1\\2\end{pmatrix},\quad T \begin{pmatrix}0\\1\end{pmatrix} = \begin{pmatrix}5\\5\\5\end{pmatrix}
$$Determine the matrix of $T$, that is, find a matrix $A$ such that $T(\vec x)=A\vec x$.
$\blacktriangleright$ Since we assumed $T$ is linear, so by our characterization such a matrix $A$ exists. Suppose the columns of $A$ are $A = [\ \vec a_{1}\ \vec a_{2}\ ]$, then note $$
A\begin{pmatrix}1\\0\end{pmatrix}=[\ \vec a_{1}\ \vec a_{2}\ ]\begin{pmatrix}1\\0\end{pmatrix} = \vec a_{1},
$$so we must have $\vec a_{1} = \begin{pmatrix}3\\1\\2\end{pmatrix}$. Similarly, $$
A \begin{pmatrix}0\\1\end{pmatrix} = [\ \vec a_{1}\ \vec a_{2}\ ]\begin{pmatrix}0 \\
1 \end{pmatrix}=\vec a_{2},
$$so $\vec a_{2}=\begin{pmatrix}5\\5\\5\end{pmatrix}$. Hence the matrix $A = \begin{pmatrix}3 & 5\\1&5\\2&5\end{pmatrix}$ is such that $T(\vec x)=A\vec x$. $\blacklozenge$
**Example.**
Suppose $T:\mathbb{R^{2}}\to \mathbb{R}^{3}$ is linear, and that $$
T\begin{pmatrix}1\\2\end{pmatrix} = \begin{pmatrix}1\\1\\2\end{pmatrix},\quad T\begin{pmatrix}3\\5\end{pmatrix} = \begin{pmatrix}7\\2\\3\end{pmatrix}.
$$Find the matrix $A$ such that $T(\vec x)=A\vec x$.
$\blacktriangleright$ Since we assume $T$ is linear, so by our characterization there is such a $3\times 2$ matrix $A$ where $T(\vec x)=A \vec x$. This matrix $A$ has $2$ columns, say $A=[\ \vec a_{1}\ \vec a_{2}\ ]$. Then we must have $$
A\begin{pmatrix}1\\2\end{pmatrix}=\begin{pmatrix}1\\1\\2\end{pmatrix},\quad A\begin{pmatrix}3\\5\end{pmatrix}=\begin{pmatrix}7\\2\\3\end{pmatrix}.
$$But $$
A \begin{pmatrix}1\\2\end{pmatrix} = [\ \vec a_{1}\ \vec a_{2}\ ]\begin{pmatrix}1\\2\end{pmatrix} = \vec a_{1}+2\vec a_{2}
$$and $$
A \begin{pmatrix}3\\5\end{pmatrix} = [\ \vec a_{1}\ \vec a_{2}\ ]\begin{pmatrix}3\\5\end{pmatrix} = 3\vec a_{1}+5\vec a_{2}
$$So we must have $$
\vec a_{1}+2\vec a_{2} = \begin{pmatrix}1\\1\\2\end{pmatrix}, \quad 3\vec a_{1}+5\vec a_{2}= \begin{pmatrix}7\\2\\3\end{pmatrix}.
$$Note this looks like a "linear system", even though instead of unknown scalars, we have unknown vector quantities. But we can use our row reduction esque method to solve them. For instance, multiply the first equation by $-3$ and add to the second equation yields $$
- \vec a_{2}=\begin{pmatrix}4\\-1\\-3\end{pmatrix} \implies \vec a_{2}= \begin{pmatrix}-4\\1\\3\end{pmatrix}.
$$And we can back-substitute, and solve for $$
\vec a_{1} = \begin{pmatrix}1\\1\\2\end{pmatrix} - 2\vec a_{2}=\begin{pmatrix}9\\-1\\-4\end{pmatrix}.
$$Hence putting it all together, we have the matrix $A$ given by $$
A = \begin{pmatrix}9 & -4\\-1 & 1\\-4 & 3\end{pmatrix}
$$is such that $T(\vec x)=A \vec x$. $\blacklozenge$
**Remark.** By the way, we know these matrices exist because we are given these functions are **linear maps between Euclidean spaces $\mathbb{R}^{k}$ and $\mathbb{R}^{n}$**. If we do not know a priori that these are linear maps, we cannot say it is a left matrix multiplication map! So in general there could be many functions that sends $\begin{pmatrix}1\\2\end{pmatrix}\mapsto \begin{pmatrix}1\\1\\2\end{pmatrix}$ and $\begin{pmatrix}3\\5\end{pmatrix}\mapsto \begin{pmatrix}7\\2\\3\end{pmatrix}$, and we have no idea in general what happens to other inputs. But if we further know this map is linear, then by our characterization, we know there will be a governing matrix $A$ that does the job, and we can proceed to find it (if we have sufficient information). So a function being linear is very restrictive, and having enough information on the inputs forces the behavior of the entire function!
The proof of this characterization will be presented next. And we will look at some geometric examples of linear maps, between Euclidean planes $\mathbb{R}^{2}$.